<?php

	Class Yomm_Library_Http {
		
		private $curlOpts = array(
			CURLOPT_HEADER => false,
			CURLOPT_TIMEOUT => 10,
			CURLOPT_RETURNTRANSFER => true
		);
		
		public function __construct()
		{
			if (!function_exists('curl_init')) {
				throw new Yomm_Error('Yomm_Library_Http needs the curl class (curl_init) for downloading stuff from other servers!');
			}	
		}
		
		public function download ($url) {
			$this->curlOpts[CURLOPT_URL] = $url;
			
			return $this->execute();
		}
		
		public function execute () {
			$ch = curl_init();
			curl_setopt_array($ch, $this->curlOpts);
			$response = curl_exec($ch);
			curl_close($ch);
			return $response;
		}
		
